Make Cumulative, NonCumulative and Private attributes. - #11665
Conversation
|
I'll wait for #11423 to be merged before I document this PR. |
|
@ppedrot This PR introduces the |
|
I think it's fair enough to say that Private Inductive is about not exporting something from the module. |
I also think this is much more standard in CS than the abusive use of "private" in the HoTT community. |
|
OK, I don't know what the use of "private" in the HoTT community is, but if this |
|
I think there's a misunderstanding (but I'm not fully sure), so let's try to clarify: a |
|
OK thank you very much for clearing things up. So private inductive types are a form of abstraction but more limited than the standard meaning of private. It is similar to types that are exported without their definition in OCaml. What about making the attribute |
It's the elimination which is restricted, not the construction. |
|
OK. Please advise a good name. |
|
Private is fine imo |
|
But @maximedenes doesn't agree (and indeed using |
Not at the moment, but please don't use private. Not only it will clash with private in the abstraction meaning, but it also clashes with the OCaml notion of private sum type, which ironically is the dual (they can be destructed but not constructed from outside). |
|
I won't oppose to |
|
New version uses Still need to write tests, doc, and a changelog entry. |
|
The documentation is still a work-in-progress (I still want to move the definition of the template and program attributes) but already gives a pretty good idea of the final result. |
|
@ppedrot Unfortunately, I couldn't make the |
Thanks. FWIW, I try to avoid DELETENT when I can because it's not too safe with respect to future grammar changes that add additional productions to the nonterminal. It's safer to delete each production explicitly with
This form is a bit safer (when applicable) because just by looking at it, you can easily verify that this doesn't alter the language accepted: SPLICE and RENAME are always safe. Later on I'll look at improving the edits/edit operations to make them simpler/safer with respect to changes. |
|
@Zimmi48 is that merely a parsing problem? In particular, could that be solved using some ad-hoc lookahead? |
|
@ppedrot I thought that lookaheads could help but I don't know how to use them. |
|
Everyone on Gitter seemed to prefer |
- Legacy attributes can now be specified in any order. - Legacy attribute Cumulative maps to universes(cumulative). - Legacy attribute NonCumulative maps to universes(noncumulative). - Legacy attribute Private maps to private(matching). We use "private(matching)" and not "private(match)" because we cannot use keywords within attributes.
And fix documentation following the removal of the Template Check flag in rocq-prover#11546.
following changes to attribute parsing.
Unfortunately, we cannot go further and parse Export as a legacy attribute because this syntax conflicts with the Export command.
23a0581 to
4b37834
Compare
|
This is ready. Can I get an assignee? |
You define a lookahead function and then use the function name in the production. The following example succeeds for the input |
|
Thanks. I tried using a lookahead but didn't manage to fix the issue. But anyway, this wouldn't provide much advantage because |
|
As this PR changes quite a lot of things in quite a number of places, I hope I won't have to wait for too long before it gets an assignee and eventually gets merged. |
ppedrot
left a comment
There was a problem hiding this comment.
I didn't check the documentation changes thoroughly, but the changes to the code look OK to me. I am a bit surprised you managed to sort the parsing issues without breaking everything, but the CI seems to be fine, so that's probably correct.
|
Let's merge, this PR has been discussed viva voce already, I don't think there is much point in delaying it further. |
|
Thanks @ppedrot! |
`master` has a more complete fix, but it is part of commit 2c785aa in rocq-prover#11665. Meanwhile, the current text is nonsense.
`master` has a more complete fix, but it is part of commit 2c785aa in rocq-prover#11665. Meanwhile, the current text is nonsense.
Kind: feature
These are the last morally attributes which were not parsed as such.
Note that initially I wanted to make the new attributes
universes(polymorphic(cumulative))anduniverses(polymorphic(noncumulative)(since these attributes must be provided in a polymorphic context). But I didn't manage to find a solution that would be backward-compatible.